﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using ChatInterfaces;
using CHATCLIENT.ServerService;

namespace CHATCLIENT
{
    public delegate void NotifyLoginUser(ClientToPass cliente);
    public delegate void NotifyLogoutUser(ClientToPass cliente);

    [CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Single, UseSynchronizationContext = true, IncludeExceptionDetailInFaults=true)]
    public class ServerOperationsCallback : IServerOperationsCallback
    {

        public NotifyLoginUser notifyLoginUser;
        public NotifyLogoutUser notifyLogoutUser;
        public ServerOperationsCallback( NotifyLoginUser delin, NotifyLogoutUser delout) 
        {
            notifyLoginUser =  new NotifyLoginUser(delin);
            notifyLogoutUser = new NotifyLogoutUser(delout);
        }

        public void NotifyLoginUser(ClientToPass cliente)
        {
            notifyLoginUser.Invoke(cliente);
        }

        public void NotifyLogoutUser(ClientToPass cliente)
        {
            notifyLogoutUser.Invoke(cliente);
        }

        public IAsyncResult BeginNotifyLoginUser(ClientToPass cliente, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public void EndNotifyLoginUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }

        public IAsyncResult BeginNotifyLogoutUser(ClientToPass cliente, AsyncCallback callback, object asyncState)
        {
            throw new NotImplementedException();
        }

        public void EndNotifyLogoutUser(IAsyncResult result)
        {
            throw new NotImplementedException();
        }
    }
}
